#pragma once

using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Data;
using namespace System::Windows::Forms;
using namespace System::Drawing;

namespace myui
{
	class Operation
	{
	public:
		enum MouseState
		{
			MouseUp,
			MouseMv,
			MouseDn
		};
		Windows::Forms::Cursor^ (Operation::*opFunc)(int,int,MouseState,Windows::Forms::MouseButtons^);
		bool isDn;
	public:
		Operation(void);

	public:  

		Windows::Forms::Cursor^ MouseOp(int x,int y,MouseState state,Windows::Forms::MouseButtons^ btn)
		{
			if(state == MouseDn)isDn = true;
			if(state == MouseUp)isDn = false;

			if(Operation::opFunc == 0)
				opFunc = &Operation::ArrowOperation;
			return (this->*opFunc)(x,y,state,btn);
		}

		Windows::Forms::Cursor^ ArrowOperation(int x,int y,MouseState state,Windows::Forms::MouseButtons^ btn)
		{
			switch(state)
			{
			case MouseDn:
				return Cursors::Arrow;
				break;
			case MouseMv:
				if(isDn)
				{
					return Cursors::Arrow;
				}
				else
				{
					return Cursors::Arrow;
				}
				break;
			case MouseUp:
				return Cursors::Arrow;
				break;
			}
			return Cursors::Arrow;
		}

		Windows::Forms::Cursor^ MoveOperationUp(int x,int y,MouseState state,Windows::Forms::MouseButtons^ btn)
		{
			//end select control
			return Cursors::SizeAll;
		}

		Windows::Forms::Cursor^ SizeOperationUp(int x,int y,MouseState state,Windows::Forms::MouseButtons^ btn)
		{
			switch(state)
			{
			case MouseDn:
				return Cursors::SizeAll;
				break;
			case MouseMv:
				if(isDn)
				{
					return Cursors::SizeAll;
				}
				else
				{
					return Cursors::SizeAll;
				}
				break;
			case MouseUp:
				return Cursors::SizeAll;
				break;
			}
			return Cursors::SizeAll;
		}

		Windows::Forms::Cursor^ CreateOperationUp(int x,int y,MouseState state,Windows::Forms::MouseButtons^ btn)
		{
			switch(state)
			{
			case MouseDn:
				return Cursors::Cross;
				break;
			case MouseMv:
				if(isDn)
				{
					return Cursors::Cross;
				}
				else
				{
					return Cursors::Cross;
				}
				break;
			case MouseUp:
				return Cursors::Cross;
				break;
			}
			return Cursors::Cross;
		}

	};
}

